<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            height: 100px;
            width: 100px;
            background: crimson;
            margin: 16px;
        }
        .active {
            background: yellowgreen;
        }
    </style>
</head>
<body>
    <div class="box active"></div>
    <div class="box"></div>
    <div class="box"></div>
    <div class="box"></div>

    <script src="../lib/jquery.min.js"></script>
    <script>
        let counter = 0;
        setInterval(() => {
            counter++;
            $('.box').eq(counter % 4).addClass('active');
            $('.box').eq(counter % 4).siblings().removeClass('active');
        }, 1000);
    </script>
</body>
</html>